//
// Created by ✎﹏ℳ๓独赏 ☆独醉 on 2023/4/19.
//

#include <stdio.h>

int tmp[100000];

void getdata(int arr[], int n) {
    int i;
    for (i = 0; i < n; i++) {
        arr[i] = n - i;
    }
}

void merge_sort(int q[], int l, int r) {
    if (l >= r) return;
    int mid = l + r >> 1;
    merge_sort(q, l, mid);
    merge_sort(q, mid + 1, r);

    int k = 0, i = l, j = mid + 1;
    while (i <= mid && j <= r) {
        if (q[i] <= q[j])tmp[k++] = q[i++];
        else tmp[k++] = q[j++];
    }

    while (i <= mid)tmp[k++] = q[i++];
    while (j <= r)tmp[k++] = q[j++];

    for (int a = l, b = 0; a <= r; a++, b++) {
        q[a] = tmp[b];
    }

}

int main() {
    int arr[50], i;
    getdata(arr, 50);
    for (i = 0; i < 50; i++) {
        printf("%d ", arr[i]);
    }
    printf("\n");
    merge_sort(arr, 0, 49);
    for (i = 0; i < 50; i++) {
        printf("%d ", arr[i]);
    }
    printf("\n");
    for(i=0;i<=100;i++){
        printf("%d ",tmp[i]);
    }
    return 0;
}